//
//  MovieCollectionViewCell.m
//  UI16_UICollectionView
//
//  Created by dllo on 16/3/30.
//  Copyright © 2016年 付冬梅. All rights reserved.
//

#import "MovieCollectionViewCell.h"

@implementation MovieCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        NSLog(@"11111111111111%s", __FUNCTION__);
        self.picView = [[UIImageView alloc] init];
        [self.contentView addSubview:self.picView];
    }
    return self;
}

- (void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes {
    NSLog(@"22222222222222222222%s", __FUNCTION__);
    self.picView.frame = CGRectMake(0, 0, self.contentView.frame.size.width, self.contentView.frame.size.height);
}

- (UICollectionViewLayoutAttributes *)preferredLayoutAttributesFittingAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes {
    NSLog(@"333333333333333333%s", __FUNCTION__);
    return layoutAttributes;
}

- (void)layoutSubviews {
    NSLog(@"44444444444444444%s", __FUNCTION__);
    [super layoutSubviews];
}

- (void)setMovieModel:(movieModel *)model {
    [self.picView sd_setImageWithURL:[NSURL URLWithString:model.medium]];
}

@end
